//
//  SecurityModel.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/6/5.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit
import ObjectMapper
enum bindLevel {
    case googleLevel
    case iphoneLevel
    case mailboxLevel
    case noneLevel
}
class SecurityModel: BaseModel, Mappable {
    var userId: Int = 0
    var email: String = ""
    var googleKey: String = ""
    var googleUrl: String = ""
    var isEmailBind: Bool = false
    var isGoogleBind: Bool = false
    var isMobileBind: Bool = false
    var isOpenGoogle: Bool = false
    var loginName: String = ""
    var mobile: String = ""
    var areaCode:String = ""
    var isTradePwd: Bool = false
    var level:bindLevel = .noneLevel
    var bindTelBool:Bool = false
    var primaryAuth:Bool = false
    var seniorAuth:Int = 0
    override init() {
        super.init()
    }
    
    required init?(map: Map) {
        userId <- map["userId"]
        email <- map["email"]
        googleKey <- map["googleKey"]
        googleUrl <- map["googleUrl"]
        isEmailBind <- map["isEmailBind"]
        isGoogleBind <- map["isGoogleBind"]
        isMobileBind <- map["isMobileBind"]
        isOpenGoogle <- map["isOpenGoogle"]
        loginName <- map["loginName"]
        mobile <- map["mobile"]
        isTradePwd <- map["isTradePwd"]
        areaCode <- map["areaCode"]
        primaryAuth <- map["primaryAuth"]
        seniorAuth <- map["seniorAuth"]
        if isOpenGoogle {
            level = bindLevel.googleLevel
        }else if isMobileBind {
            level = bindLevel.iphoneLevel
        }else if isEmailBind{
            level = bindLevel.mailboxLevel
        }else {
            level = bindLevel.noneLevel
        }
        
    }
    
    func mapping(map: Map) {
        
    }
}
